<script type="text/javascript"><!--//--><![CDATA[//><!--

    $(document).ready(function() {
        // Setup Form
		$('#form_master').setupForm([
            { name: 'or_po_no', type: 'text', size: 'long', maxlength: 100, noempty:true, readonly:true },
			{ name: 'or_sttb_no', type: 'text', size: 'long', maxlength: 100, noempty:true, readonly:true },
			{ name: 'or_sttb_faktur', type: 'text', size: 'short' },
			{ name: 'or_po_date', type: 'date' },
			{ name: 'or_sttb_date', type: 'date' },
			{ name: 'or_sttb_jatuhtempo', type: 'date' },
			{ name: 'contact_id_sttb', type: 'text', size: '24' },
        ], <?php echo json_encode($data); ?>);
        
		
        <?php if($mode=="edit"){ ?>
        $('#or_po_date').readonly();
        <?php } ?>
		
		// Set Action Button
		var buttons = [{ label: 'Save', icon: 'save', onclick: function() { 
							$('#form_master').submitForm(	'/'+controller+'/ajax_post', 
							{ detail:[	{ table: 'dtl_sample2', field:['or_po_no','kd_barang','qty_order','no_sttb','qty_terima','harga']}																		], 
																onComplete : function(data){ eval('oData = '+data); loadPage('/'+controller+'/edit/?no_po='+(oData.genid!='' ? oData.genid : $('#no_po').getval())); }
															} 
														); 
						}},
					   { label: 'Close', icon: 'cancel', onclick: function() { loadPage('/'+controller+'/Index'); } }];
		setAction(buttons);
		
		// Create Tab
		$('#tt').tabs({ border:false });  
		
		// Focus at First Object
		$('#form_master').focusFirst();
    });
//--><!]]></script>

<div id="form_master_message" style="display:none;"></div>

<table class="tb_form" style="display:none;" cellpadding="0" cellspacing="0">

<tr>
    <td class="label">No PO</td>
    <td><input id="or_po_no" /></td>
    <td class="label">Tanggal PO</td>
    <td><input id="or_po_date" /></td>
</tr>

<tr>
    <td class="label">No STTB</td>
    <td><input id="or_sttb_no" /></td>
    <td class="label">Tanggal STTB</td>
    <td><input id="or_sttb_date" /></td>
</tr>

<tr>
    <td class="label">No Faktur</td>
    <td><input id="or_sttb_faktur" /></td>
    <td class="label">Status</td>
    <td>
        <select id="or_status" class="easyui-combobox" name="or_status" style="width:200px;">
            <option selected disabled hidden value='Select'></option>"
            <option value="T">Tunai</option>
            <option value="K">Kredit</option>
        </select>
    </td>
</tr>

<tr>
	<td class="label">Jatuh Tempo</td>
    <td><input id="or_sttb_jatuhtempo" /></td>
    <td class="label">Penerima Barang</td>
    <td><input id="contact_id_sttb" /></td>
</tr>

<tr>
    <td class="label">Status</td>
    <td>
    	<select id="barang_status_aktif" name="barang_status_aktif">
    	<option value=""></option>
    	<option value="R">Receive</option>
    	<option value="O" selected>Order</option>
    </select>
	</td>
</tr>

</table>

<div id="tt" class="easyui-tabs" style="min-height:400px;">  
	
    
    <div title="Detail Barang" style="overflow:auto;padding:10px;">  
    	<?php require_once('formdtl_sample2.php'); ?>
    </div>
    
</div>